package com.mjf.thread;

import java.util.concurrent.TimeUnit;

class MyRunnable implements Runnable {

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+" Come in call");
        //睡5秒
        try {
            TimeUnit.SECONDS.sleep(5);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

public class CreateThreadWithRunnable {
    public static void main(String[] args) {

        MyRunnable myRunnable = new MyRunnable();
        new Thread(myRunnable, "runnable").start();
        System.out.println("主线程结束！");

    }
}